package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
	"web/global"
	"web/pkg/setting"
	"web/pkg/util"
	"web/routers"
)

func init() {
	setting.Setup()
	global.Setup()
	//logging.Setup()
	//gredis.Setup()
	util.Setup()
}
func main() {
	gin.SetMode("debug") // 直接设置运行模式为debug
	router := routers.InitRouter()

	s := &http.Server{
		Addr:           "0.0.0.0:8000", // 直接硬编码端口号为8000
		Handler:        router,
		ReadTimeout:    60 * time.Second, // 直接设置超时时间
		WriteTimeout:   60 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	fmt.Printf("服务器启动中，监听地址: %s\n", s.Addr)
	if err := s.ListenAndServe(); err != nil {
		fmt.Printf("服务器启动失败: %v\n", err)
	}
}
